import jieba
import jieba.posseg as pseg

# 文本
text = "张三昨天和李四一起去上海旅行，参观了上海博物馆，还去了外滩。"
# 使用pseg进行分词和词性标注
words = pseg.cut(text)
# 输出结果
for word, flag in words:
    print(f'{word} {flag}')
